import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import CoreLayout from 'containers/layout'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { getDataSource, getFlagValue, showTeam, getTeamFlag, getPageFlag } from 'services/utils'
import { Form, Input, InputNumber, DatePicker, Divider, Button, Tabs, Select, Radio, Row, Col, Tooltip, Icon, message } from 'antd'
import TagSelect from 'ant-design-pro/lib/TagSelect'
import { ItemSelect } from '../../components'
import { protoActions } from 'reduxs'
import _ from 'lodash'
import moment from 'moment'
import 'ant-design-pro/dist/ant-design-pro.css'

import SettingPane from './components/setting-pane'

const FormItem = Form.Item
const Option = Select.Option
const RadioGroup = Radio.Group
const RadioButton = Radio.Button
const TextArea = Input.TextArea
const TabPane = Tabs.TabPane
const accessFlag = getPageFlag('/system-tools/setting', 'access')

@connect(
  state => ({
    auth                : state.Passport.auth,
    teams               : state.Passport.teams,
  }),
  dispatch => ({
    actions: bindActionCreators({ 
      ...protoActions
    }, dispatch)
  })
)
export default class Setting extends PureComponent {

  constructor (props) {
    super(props)
    this.state = {
      tabKey: 'base'
    }
  }

  componentDidMount () {
    //this.props.actions.getlist()
  }

  render () {
    const { location, auth, teams } = this.props
    const options = {
      location,
      pageCode: accessFlag.value,
      breadcrumb: [
        { name: '主页', link: '/' },
        { name: '系统工具' },
        { name: '系统配置' }
      ],
    }
    
    return (
      <CoreLayout {...options}>
        <div className="ant-advanced-search-form" style={{ minHeight: 800 }}>
          <Tabs defaultActiveKey={this.state.tabKey}>
            <TabPane tab={<span><Icon type="home" />基础配置</span>} key="base">
              <SettingPane 
                tag="base"
                //disabled
                />
            </TabPane>
            <TabPane tab={<span><Icon type="flag" />渠道表</span>} key="paths">
              <SettingPane 
                tag="paths"
                />
            </TabPane>
            <TabPane tab={<span><Icon type="paper-clip" />道具表</span>} key="items">
              <SettingPane 
                tag="items"
                />
            </TabPane>
            <TabPane tab={<span><Icon type="switcher" />房间表</span>} key="room">
              <SettingPane 
                tag="room"
                />
            </TabPane>
            <TabPane tab={<span><Icon type="environment-o" />房间鱼表</span>} key="roomfish">
              <SettingPane 
                tag="roomfish"
                />
            </TabPane>
            <TabPane tab={<span><Icon type="code" />解析器</span>} key="parser">
              <SettingPane 
                tag="parser"
                />
            </TabPane>
            <TabPane tab={<span><Icon type="hdd" />SRV服务器</span>} key="srv">
              <SettingPane 
                tag="srv"
                />
            </TabPane>
            <TabPane tab={<span><Icon type="pushpin-o" />类型表</span>} key="types">
              <SettingPane 
                tag="types"
                />
            </TabPane>
          </Tabs>
        </div>
      </CoreLayout>
    )
  }
}